package cn.yunhe.insurance.util;


import org.apache.http.HttpResponse;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class PhoneCodeUtil {

   public static String getPhoneVeryCode(String phoneNumber){
        Random random = new Random();
        String res="";
        for (int i=0;i<6;i++)
        {
            res+=random.nextInt(10);
        }
        String host = "https://fesms.market.alicloudapi.com";
        String path = "/sms/";
        String method = "GET";
        String appcode = "c4f0726185f1406e912ee88088bbd207";
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Authorization", "APPCODE " + appcode);
        Map<String, String> querys = new HashMap<String, String>();
        querys.put("code", res);
        querys.put("phone", phoneNumber);
        querys.put("skin", "35696");
        try {
            HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return res;
    }


}
